﻿// This class is "generated" and will be overwritten.
// Your customizations should be made in BugsSummaryTable.cs


using System;
using System.Data;
using System.Collections;
using System.Runtime;
using System.Data.SqlTypes;
using BaseClasses;
using BaseClasses.Data;
using BaseClasses.Data.SqlProvider;
using BUGLOG.Data;

namespace BUGLOG.Business
{

/// <summary>
/// The generated superclass for the <see cref="BugsSummaryTable"></see> class.
/// Provides access to the schema information and record data of a database table or view named BugsSummary.
/// </summary>
/// <remarks>
/// The connection details (name, location, etc.) of the database and table (or view) accessed by this class 
/// are resolved at runtime based on the connection string in the application's Web.Config file.
/// <para>
/// This class is not intended to be instantiated directly.  To obtain an instance of this class, use 
/// <see cref="BugsSummaryTable.Instance">BugsSummaryTable.Instance</see>.
/// </para>
/// </remarks>
/// <seealso cref="BugsSummaryTable"></seealso>
[SerializableAttribute()]
public class BaseBugsSummaryTable : PrimaryKeyTable
{

    private readonly string TableDefinitionString = BugsSummaryDefinition.GetXMLString();







    protected BaseBugsSummaryTable()
    {
        this.Initialize();
    }

    protected virtual void Initialize()
    {
        XmlTableDefinition def = new XmlTableDefinition(TableDefinitionString);
        this.TableDefinition = new TableDefinition();
        this.TableDefinition.TableClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "BUGLOG.Business.BugsSummaryTable");
        def.InitializeTableDefinition(this.TableDefinition);
        this.ConnectionName = def.GetConnectionName();
        this.RecordClassName = System.Reflection.Assembly.CreateQualifiedName("App_Code", "BUGLOG.Business.BugsSummaryRecord");
        this.ApplicationName = "App_Code";
        this.DataAdapter = new BugsSummarySqlTable();
        ((BugsSummarySqlTable)this.DataAdapter).ConnectionName = this.ConnectionName;
((BugsSummarySqlTable)this.DataAdapter).ApplicationName = this.ApplicationName;
        this.TableDefinition.AdapterMetaData = this.DataAdapter.AdapterMetaData;
    }

#region "Properties for columns"

    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.BugId column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn BugIdColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[0];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.BugId column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn BugId
    {
        get
        {
            return BugsSummaryTable.Instance.BugIdColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.BugShortDescription column object.
    /// </summary>
    public BaseClasses.Data.StringColumn BugShortDescriptionColumn
    {
        get
        {
            return (BaseClasses.Data.StringColumn)this.TableDefinition.ColumnList[1];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.BugShortDescription column object.
    /// </summary>
    public static BaseClasses.Data.StringColumn BugShortDescription
    {
        get
        {
            return BugsSummaryTable.Instance.BugShortDescriptionColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Date column object.
    /// </summary>
    public BaseClasses.Data.DateColumn Date0Column
    {
        get
        {
            return (BaseClasses.Data.DateColumn)this.TableDefinition.ColumnList[2];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Date column object.
    /// </summary>
    public static BaseClasses.Data.DateColumn Date0
    {
        get
        {
            return BugsSummaryTable.Instance.Date0Column;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.userID column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn UserId0Column
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[3];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.userID column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn UserId0
    {
        get
        {
            return BugsSummaryTable.Instance.UserId0Column;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.PriorityID column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn PriorityIDColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[4];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.PriorityID column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn PriorityID
    {
        get
        {
            return BugsSummaryTable.Instance.PriorityIDColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.StatusID column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn StatusIDColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[5];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.StatusID column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn StatusID
    {
        get
        {
            return BugsSummaryTable.Instance.StatusIDColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Assigned column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn AssignedColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[6];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Assigned column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn Assigned
    {
        get
        {
            return BugsSummaryTable.Instance.AssignedColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.FixedBy column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn FixedByColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[7];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.FixedBy column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn FixedBy
    {
        get
        {
            return BugsSummaryTable.Instance.FixedByColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Description column object.
    /// </summary>
    public BaseClasses.Data.StringColumn DescriptionColumn
    {
        get
        {
            return (BaseClasses.Data.StringColumn)this.TableDefinition.ColumnList[8];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Description column object.
    /// </summary>
    public static BaseClasses.Data.StringColumn Description
    {
        get
        {
            return BugsSummaryTable.Instance.DescriptionColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.EnvBUGLOGment column object.
    /// </summary>
    public BaseClasses.Data.StringColumn EnvBUGLOGmentColumn
    {
        get
        {
            return (BaseClasses.Data.StringColumn)this.TableDefinition.ColumnList[9];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.EnvBUGLOGment column object.
    /// </summary>
    public static BaseClasses.Data.StringColumn EnvBUGLOGment
    {
        get
        {
            return BugsSummaryTable.Instance.EnvBUGLOGmentColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.StepsToReproduce column object.
    /// </summary>
    public BaseClasses.Data.StringColumn StepsToReproduceColumn
    {
        get
        {
            return (BaseClasses.Data.StringColumn)this.TableDefinition.ColumnList[10];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.StepsToReproduce column object.
    /// </summary>
    public static BaseClasses.Data.StringColumn StepsToReproduce
    {
        get
        {
            return BugsSummaryTable.Instance.StepsToReproduceColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Note column object.
    /// </summary>
    public BaseClasses.Data.ClobColumn NoteColumn
    {
        get
        {
            return (BaseClasses.Data.ClobColumn)this.TableDefinition.ColumnList[11];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.Note column object.
    /// </summary>
    public static BaseClasses.Data.ClobColumn Note
    {
        get
        {
            return BugsSummaryTable.Instance.NoteColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.ImageAttachment column object.
    /// </summary>
    public BaseClasses.Data.ImageColumn ImageAttachmentColumn
    {
        get
        {
            return (BaseClasses.Data.ImageColumn)this.TableDefinition.ColumnList[12];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.ImageAttachment column object.
    /// </summary>
    public static BaseClasses.Data.ImageColumn ImageAttachment
    {
        get
        {
            return BugsSummaryTable.Instance.ImageAttachmentColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.TaskID column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn TaskIDColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[13];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.TaskID column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn TaskID
    {
        get
        {
            return BugsSummaryTable.Instance.TaskIDColumn;
        }
    }
    
    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.TestCaseID column object.
    /// </summary>
    public BaseClasses.Data.NumberColumn TestCaseIDColumn
    {
        get
        {
            return (BaseClasses.Data.NumberColumn)this.TableDefinition.ColumnList[14];
        }
    }
    

    
    /// <summary>
    /// This is a convenience property that provides direct access to the table's BugsSummary_.TestCaseID column object.
    /// </summary>
    public static BaseClasses.Data.NumberColumn TestCaseID
    {
        get
        {
            return BugsSummaryTable.Instance.TestCaseIDColumn;
        }
    }
    
    


#endregion

    
#region "Shared helper methods"

    /// <summary>
    /// This is a shared function that can be used to get an array of BugsSummaryRecord records using a where clause.
    /// </summary>
    public static BugsSummaryRecord[] GetRecords(string where)
    {
        return GetRecords(where, null, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE);
    }

    /// <summary>
    /// This is a shared function that can be used to get an array of BugsSummaryRecord records using a where and order by clause.
    /// </summary>
    public static BugsSummaryRecord[] GetRecords(string where, OrderBy orderBy)
    {
        return GetRecords(where, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MAX_BATCH_SIZE);
    }
    
    /// <summary>
    /// This is a shared function that can be used to get an array of BugsSummaryRecord records using a where and order by clause clause with pagination.
    /// </summary>
    public static BugsSummaryRecord[] GetRecords(string where, OrderBy orderBy, int pageIndex, int pageSize)
    {
        SqlFilter whereFilter = null;
        if (where != null && where.Trim() != "")
        {
           whereFilter = new SqlFilter(where);
        }

        ArrayList recList = BugsSummaryTable.Instance.GetRecordList(whereFilter, orderBy, pageIndex, pageSize);

        return (BugsSummaryRecord[])recList.ToArray(Type.GetType("BUGLOG.Business.BugsSummaryRecord"));
    }   
    
    public static BugsSummaryRecord[] GetRecords(
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
	{

        ArrayList recList = BugsSummaryTable.Instance.GetRecordList(where.GetFilter(), orderBy, pageIndex, pageSize);

        return (BugsSummaryRecord[])recList.ToArray(Type.GetType("BUGLOG.Business.BugsSummaryRecord"));
    }

    /// <summary>
    /// This is a shared function that can be used to get total number of records that will be returned using the where clause.
    /// </summary>
    public static int GetRecordCount(string where)
    {
        SqlFilter whereFilter = null;
        if (where != null && where.Trim() != "")
        {
           whereFilter = new SqlFilter(where);
        }

        return (int)BugsSummaryTable.Instance.GetRecordListCount(whereFilter, null);
    }
    
    public static int GetRecordCount(WhereClause where)
    {
        return (int)BugsSummaryTable.Instance.GetRecordListCount(where.GetFilter(), null);
    }
    
    /// <summary>
    /// This is a shared function that can be used to get a BugsSummaryRecord record using a where clause.
    /// </summary>
    public static BugsSummaryRecord GetRecord(string where)
    {
        OrderBy orderBy = null;
        return GetRecord(where, orderBy);
    }
    
    /// <summary>
    /// This is a shared function that can be used to get a BugsSummaryRecord record using a where and order by clause.
    /// </summary>
    public static BugsSummaryRecord GetRecord(string where, OrderBy orderBy)
    {
        SqlFilter whereFilter = null;
        if (where != null && where.Trim() != "")
        {
           whereFilter = new SqlFilter(where);
        }
        
        ArrayList recList = BugsSummaryTable.Instance.GetRecordList(whereFilter, orderBy, BaseTable.MIN_PAGE_NUMBER, BaseTable.MIN_BATCH_SIZE);

        BugsSummaryRecord rec = null;
        if (recList.Count > 0)
        {
            rec = (BugsSummaryRecord)recList[0];
        }

        return rec;
    }
    
    public static String[] GetValues(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int maxItems)
	{

        // Create the filter list.
        SqlBuilderColumnSelection retCol = new SqlBuilderColumnSelection(false, true);
        retCol.AddColumn(col);

        return BugsSummaryTable.Instance.GetColumnValues(retCol, where.GetFilter(), orderBy, BaseTable.MIN_PAGE_NUMBER, maxItems);

    }
    
    /// <summary>
    /// This is a shared function that can be used to get a DataTable to bound with a data bound control using a where clause.
    /// </summary>
    public static System.Data.DataTable GetDataTable(string where)
    {
        BugsSummaryRecord[] recs = GetRecords(where);
        return  BugsSummaryTable.Instance.CreateDataTable(recs, null);
    }

    /// <summary>
    /// This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause.
    /// </summary>
    public static System.Data.DataTable GetDataTable(string where, OrderBy orderBy)
    {
        BugsSummaryRecord[] recs = GetRecords(where, orderBy);
        return  BugsSummaryTable.Instance.CreateDataTable(recs, null);
    }
    
    /// <summary>
    /// This is a shared function that can be used to get a DataTable to bound with a data bound control using a where and order by clause with pagination.
    /// </summary>
    public static System.Data.DataTable GetDataTable(string where, OrderBy orderBy, int pageIndex, int pageSize)
    {
        BugsSummaryRecord[] recs = GetRecords(where, orderBy, pageIndex, pageSize);
        return  BugsSummaryTable.Instance.CreateDataTable(recs, null);
    }
    
    /// <summary>
    /// This is a shared function that can be used to delete records using a where clause.
    /// </summary>
    public static void DeleteRecords(string where)
    {
        if (where == null || where.Trim() == "")
        {
           return;
        }
        
        SqlFilter whereFilter = new SqlFilter(where);
        BugsSummaryTable.Instance.DeleteRecordList(whereFilter);
    }
    
    /// <summary>
    /// This is a shared function that can be used to export records using a where clause.
    /// </summary>
    public static string Export(string where)
    {
        SqlFilter whereFilter = null;
        if (where != null && where.Trim() != "")
        {
           whereFilter = new SqlFilter(where);
        }
        
        return  BugsSummaryTable.Instance.ExportRecordData(whereFilter);
    }
   
    public static string Export(WhereClause where)
    {
        BaseFilter whereFilter = null;
        if (where != null)
        {
            whereFilter = where.GetFilter();
        }

        return BugsSummaryTable.Instance.ExportRecordData(whereFilter);
    }
    
	public static string GetSum(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
	{
        SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
        colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Sum);

        return BugsSummaryTable.Instance.GetColumnStatistics(colSel, where.GetFilter(), orderBy, pageIndex, pageSize);
    }
    
    public static string GetCount(
		BaseColumn col,
		WhereClause where,
		OrderBy orderBy,
		int pageIndex,
		int pageSize)
	{
        SqlBuilderColumnSelection colSel = new SqlBuilderColumnSelection(false, false);
        colSel.AddColumn(col, SqlBuilderColumnOperation.OperationType.Count);

        return BugsSummaryTable.Instance.GetColumnStatistics(colSel, where.GetFilter(), orderBy, pageIndex, pageSize);
    }

    /// <summary>
    ///  This method returns the columns in the table.
    /// </summary>
    public static BaseColumn[] GetColumns() 
    {
        return BugsSummaryTable.Instance.TableDefinition.Columns;
    }

    /// <summary>
    ///  This method returns the columnlist in the table.
    /// </summary>   
    public static ColumnList GetColumnList() 
    {
        return BugsSummaryTable.Instance.TableDefinition.ColumnList;
    }

    /// <summary>
    /// This method creates a new record and returns it to be edited.
    /// </summary>
    public static IRecord CreateNewRecord() 
    {
        return BugsSummaryTable.Instance.CreateRecord();
    }

    /// <summary>
    /// This method creates a new record and returns it to be edited.
    /// </summary>
    /// <param name="tempId">ID of the new record.</param>   
    public static IRecord CreateNewRecord(string tempId) 
    {
        return BugsSummaryTable.Instance.CreateRecord(tempId);
    }

    /// <summary>
    /// This method checks if column is editable.
    /// </summary>
    /// <param name="columnName">Name of the column to check.</param>
    public static bool isReadOnlyColumn(string columnName) 
    {
        BaseColumn column = GetColumn(columnName);
        if (!(column == null)) 
        {
            return column.IsValuesReadOnly;
        }
        else 
        {
            return true;
        }
    }

    /// <summary>
    /// This method gets the specified column.
    /// </summary>
    /// <param name="uniqueColumnName">Unique name of the column to fetch.</param>
    public static BaseColumn GetColumn(string uniqueColumnName) 
    {
        BaseColumn column = BugsSummaryTable.Instance.TableDefinition.ColumnList.GetByUniqueName(uniqueColumnName);
        return column;
    }

        //Convenience method for getting a record using a string-based record identifier
        public static BugsSummaryRecord GetRecord(string id, bool bMutable)
        {
            return (BugsSummaryRecord)BugsSummaryTable.Instance.GetRecordData(id, bMutable);
        }

        //Convenience method for getting a record using a KeyValue record identifier
        public static BugsSummaryRecord GetRecord(KeyValue id, bool bMutable)
        {
            return (BugsSummaryRecord)BugsSummaryTable.Instance.GetRecordData(id, bMutable);
        }

        //Convenience method for creating a record
        public KeyValue NewRecord(
        string BugShortDescriptionValue, 
        string Date0Value, 
        string UserId0Value, 
        string PriorityIDValue, 
        string StatusIDValue, 
        string AssignedValue, 
        string FixedByValue, 
        string DescriptionValue, 
        string EnvBUGLOGmentValue, 
        string StepsToReproduceValue, 
        string NoteValue, 
        string ImageAttachmentValue, 
        string TaskIDValue, 
        string TestCaseIDValue
    )
        {
            IPrimaryKeyRecord rec = (IPrimaryKeyRecord)this.CreateRecord();
                    rec.SetString(BugShortDescriptionValue, BugShortDescriptionColumn);
        rec.SetString(Date0Value, Date0Column);
        rec.SetString(UserId0Value, UserId0Column);
        rec.SetString(PriorityIDValue, PriorityIDColumn);
        rec.SetString(StatusIDValue, StatusIDColumn);
        rec.SetString(AssignedValue, AssignedColumn);
        rec.SetString(FixedByValue, FixedByColumn);
        rec.SetString(DescriptionValue, DescriptionColumn);
        rec.SetString(EnvBUGLOGmentValue, EnvBUGLOGmentColumn);
        rec.SetString(StepsToReproduceValue, StepsToReproduceColumn);
        rec.SetString(NoteValue, NoteColumn);
        rec.SetString(ImageAttachmentValue, ImageAttachmentColumn);
        rec.SetString(TaskIDValue, TaskIDColumn);
        rec.SetString(TestCaseIDValue, TestCaseIDColumn);


            rec.Create(); //update the DB so any DB-initialized fields (like autoincrement IDs) can be initialized

            return rec.GetID();
        }
        
        /// <summary>
		///  This method deletes a specified record
		/// </summary>
		/// <param name="kv">Keyvalue of the record to be deleted.</param>
		public static void DeleteRecord(KeyValue kv)
		{
			BugsSummaryTable.Instance.DeleteOneRecord(kv);
		}

		/// <summary>
		/// This method checks if record exist in the database using the keyvalue provided.
		/// </summary>
		/// <param name="kv">Key value of the record.</param>
		public static bool DoesRecordExist(KeyValue kv)
		{
			bool recordExist = true;
			try
			{
				BugsSummaryTable.GetRecord(kv, false);
			}
			catch (Exception ex)
			{
				recordExist = false;
			}
			return recordExist;
		}

        /// <summary>
        ///  This method returns all the primary columns in the table.
        /// </summary>
        public static ColumnList GetPrimaryKeyColumns() 
        {
            if (!(BugsSummaryTable.Instance.TableDefinition.PrimaryKey == null)) 
            {
                return BugsSummaryTable.Instance.TableDefinition.PrimaryKey.Columns;
            }
            else 
            {
                return null;
            }
        }

        /// <summary>
        /// This method takes a key and returns a keyvalue.
        /// </summary>
        /// <param name="key">key could be array of primary key values in case of composite primary key or a string containing single primary key value in case of non-composite primary key.</param>
        public static KeyValue GetKeyValue(object key) 
        {
            KeyValue kv = null;
            if (!(BugsSummaryTable.Instance.TableDefinition.PrimaryKey == null)) 
            {
                bool isCompositePrimaryKey = false;
                isCompositePrimaryKey = BugsSummaryTable.Instance.TableDefinition.PrimaryKey.IsCompositeKey;
                if ((isCompositePrimaryKey && key.GetType().IsArray)) 
                {
                    //  If the key is composite, then construct a key value.
                    kv = new KeyValue();
                    Array keyArray = ((Array)(key));
                    if (!(keyArray == null)) 
                    {
                        int length = keyArray.Length;
                        ColumnList pkColumns = BugsSummaryTable.Instance.TableDefinition.PrimaryKey.Columns;
                        int index = 0;
                        foreach (BaseColumn pkColumn in pkColumns) 
                        {
                            string keyString = ((keyArray.GetValue(index)).ToString());
                            if (BugsSummaryTable.Instance.TableDefinition.TableType == BaseClasses.Data.TableDefinition.TableTypes.Virtual)
                            {
                                kv.AddElement(pkColumn.UniqueName, keyString);
                            }
                            else 
                            {
                                kv.AddElement(pkColumn.InternalName, keyString);
                            }

                            index = (index + 1);
                        }
                    }
                }
                else 
                {
                    //  If the key is not composite, then get the key value.
                    kv = BugsSummaryTable.Instance.TableDefinition.PrimaryKey.ParseValue(((key).ToString()));
                }
            }
            return kv;
        }

#endregion
}

}
